function ScreenPagesManager() {
	window.addEventListener('DOMContentLoaded', function() {
		addPageToHistory(_$(".jCurrent"), "slideup");
		_$handleTouch(document.body, [ ".cancel", ".goback" ]).bind("evt_Tap", goBack);
		document.body.addEventListener("touchmove", function(event) {event.preventDefault();}, false);
	}, false);
	
	var _inProg;
	function animatePages(fromPage, toPage, animationName, backwards) {
		// $(':focus').blur();
		//scrollTo(0, 0);
		fromPage.addEventListener('webkitAnimationEnd', _finalize, false);	
		_$domAddCls(toPage, animationName + ' in jCurrent ' + (backwards ? ' reverse' : ''));
		_$domAddCls(fromPage, animationName + ' out' + (backwards ? ' reverse' : ''));
		var iid = setTimeout(_finalize, 300);
		_inProg = true;
		function _finalize(){
			clearTimeout(iid);
			_$domRemCls(toPage, 'in reverse ' + animationName);	
			_$domRemCls(fromPage, 'jCurrent out reverse ' + animationName);
			fromPage.removeEventListener('webkitAnimationEnd', arguments.callee, false);
			
			setTimeout(function(){_inProg = false;}, 300);		
		}
	}

	function goToScreen(pageId, animationName) {
		var fromPage = document.body.querySelector(".jCurrent");
		var toPage = document.body.querySelector("#" + pageId) || pageId;
		if (fromPage == null || toPage == null || fromPage === toPage) {
			console.error("#goToPage not exist");
			return;
		}
		animatePages(fromPage, toPage, animationName);
		addPageToHistory(toPage, animationName);
	}

	function goBack(notUsed) {
		if (hist.length < 2)return;
		var animation = hist[0].animation;
		var fromPage = hist[0].page;
		// Remove all pages in front of the target page
		hist.splice(0, 1);
		// Grab the target page
		var toPage = hist[0].page;
		var animationName = hist[0].animation;
		animatePages(fromPage, toPage, animationName, true);
	}

	var hist = [];
	function addPageToHistory(page, animation) {
		// Grab some info
		var pageId = page.getAttribute('id');
		// Prepend info to page history
		hist.unshift( {
			page : page,
			animation : animation,
			id : pageId
		});
	}

	return {
		goToScreen : goToScreen,
		goBack : goBack,
		inProg : function(){return _inProg}
	}
}